package com.yips.service.web;

import com.yips.domain.entity.SysUser;
import com.yips.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Gralt of Rivia
 * 2022/5/8 19:01
 * 用户权限处理
 */
@Component
public class SysPermissionService {

    @Autowired
    private SysMenuService menuService;

    /**
     * 获取菜单数据权限
     *
     * @param user 用户信息
     * @return 菜单权限信息
     */
    public Set<String> getMenuPermission(SysUser user) {

        return new HashSet<String>(menuService.selectMenuPermsByUserId(user.getUserId()));
    }
}
